<?php
defined('InNcPHP') or exit('Access Invalid!');

/**
 * 门票类型字典
 * Class ticket_typeModel
 */
class ticket_typeModel extends Model {

	public function __construct(){
		parent::__construct('ticket_type');
	}

    /**
     * 获取所有类型信息
     * @return mixed
     */
	public function getTicketTypeList()
    {
        return $this->select();
    }

    /**
     * 获取某个类型的信息
     * @param int $type_id
     * @return mixed
     */
    public function getTicketType($type_id)
    {
        return $this->where(array('type_id'=>$type_id))->find();
    }

    /**
     * 获取某个类型的信息
     * @param array $condition
     * @return mixed
     */
    public function getTicketTypeInfo($condition = array())
    {
        return $this->where($condition)->find();
    }

    /**
     * 分页获取
     * @param array $condition
     * @param string $field
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public function getTicketTypePage($condition = array(), $field = '*', $page = 10, $order = 'type_id desc'){
        return $this->field($field)->where($condition)->page($page)->order($order)->select();
    }

    /**
     * 添加
     * @param array $param
     * @return mixed
     */
    public function addTicketType($param){
        return $this->insert($param);
    }

    /**
     * 更新
     * @param array $condition
     * @param array $param
     * @return mixed
     */
    public function updateTicketType($condition, $param){
        return $this->where($condition)->update($param);
    }

    /**
     * 删除
     * @param array $condition
     * @return mixed
     */
    public function delTicketType($condition)
    {
        return $this->where($condition)->delete();
    }
}
?>